﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Bank
{
    public class Money
    {
        private Decimal kwota;

        public Decimal Kwota
        {
            get { return kwota; }
            set { kwota = value; }
        }

        public Money()
        {
            kwota = 0;
        }

        public Money(Decimal k)
        {
            kwota = k;
        }

        public static bool operator ==(Money y, Decimal x)
        {
            
            return y.kwota == x;
        }

        public static bool operator !=(Money y, Decimal x)
        {

            return y.kwota != x;
        }

        public static Money operator +(Money x, Money y)
        {
            Money m = new Money();

            m.kwota = x.kwota + y.kwota;

            return m;
        }

        public static Money operator -(Money x, Money y)
        {
            Money m = new Money();

            m.kwota = x.kwota - y.kwota;

            return m;
        }

        public static Money operator *(Money x, Money y)
        {
            Money m = new Money();
            m.kwota = x.kwota * y.kwota;

            return m;
        }

        public static Money operator /(Money x, Money y)
        {
            Money m = new Money();

            m.kwota = x.kwota / y.kwota;

            return m;
        }

        public static Money operator +(Money x, Decimal y)
        {
            Money m = new Money();

            m.kwota = x.kwota + y;

            return m;
        }

        public static Money operator -(Money x, Decimal y)
        {
            Money m = new Money();

            m.kwota = x.kwota - y;

            return m;
        }

        public static Money operator *(Money x, Decimal y)
        {
            Money m = new Money();
            m.kwota = x.kwota * y;

            return m;
        }

        public static Money operator /(Money x, Decimal y)
        {
            Money m = new Money();

            m.kwota = x.kwota / y;

            return m;
        }

        

        public static bool operator <(Money x, Money y)
        {
            return x.kwota < y.kwota;
        }
        public static bool operator >(Money x, Money y)
        {
            return x.kwota > y.kwota;
        }

        public static bool operator <(Money x, Decimal y)
        {
            return x.kwota < y;
        }
        public static bool operator >(Money x, Decimal y)
        {
            return x.kwota > y;
        }

        public static bool operator <(Money x, Int32 y)
        {
            return x.kwota < y;
        }
        public static bool operator >(Money x, Int32 y)
        {
            return x.kwota > y;
        }


        public static bool operator <=(Money x, Decimal y)
        {
            return x.kwota <= y;
        }
        public static bool operator >=(Money x, Decimal y)
        {
            return x.kwota >= y;
        }

        public static bool operator <=(Money x, Int32 y)
        {
            return x.kwota <= y;
        }
        public static bool operator >=(Money x, Int32 y)
        {
            return x.kwota >= y;
        }


     

        public static Money Round(Money m , int decimals)
        {
            Money newM = new Money();
            newM.Kwota = Math.Round(m.kwota, decimals);
            return newM;
        }

        public static Money Abs(Money m)
        {
            Money newM = new Money();
            newM.Kwota = Math.Abs(m.kwota);
            return newM;

        }
    }
}
